home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997 September / Macworld (1997-09).dmg / Serious Software / Cherwell Scientific Demos / pro Fit / pro Fit 5.0 demo (fpu).sea / pro Fit 5.0 demo (fpu) / pro Fit 5.0.1 demo (fpu).rsrc / STR#_400.txt < prev    next >
Encoding:
Text File  |  1996-09-30  |  2.6 KB  |  225 lines

  1. function sampleFunc;
  2.  
  3. description 'Some words about', 
  4.             'the function';
  5.  
  6. parameters 2;
  7. defaults a[1]:=0,active,'delta',-1,1;
  8.          a[2]:=3,inactive,'beta',-inf,inf;
  9.  
  10. const c=2.99792458e8;
  11.  
  12. var firsttime: boolean;
  13.     ex1,ex2,sqrx: extended;
  14.  
  15.  
  16.  
  17. procedure initialize;
  18. begin
  19.  firsttime:=true;
  20. end;
  21.  
  22. function check;
  23. begin
  24.   check:=OK;
  25.   if (pNumber=2) and (a[2]=0) then
  26.     check:=BAD;
  27. end;
  28.  
  29. procedure first;
  30. begin
  31.     if firsttime then
  32.     begin
  33.      firsttime:=false;
  34.      ex1:=data[1,1]/c;
  35.     end;
  36.  
  37.  
  38.  ex2:= a[1] * ex1;
  39. end;
  40.  
  41. procedure derivatives;
  42. begin
  43.   dyda[1]:= sqrx*ex1;
  44.   dyda[2]:= -x/sqr(a[2]);
  45. end;
  46.  
  47. procedure last;
  48. begin
  49.   beep;
  50.   firsttime:=true;
  51. end;
  52.  
  53. begin
  54.         sqrx:=sqr(x);
  55.   y:= sqrx*ex2 + x/a[2];
  56. end;
  57.  
  58.  
  59. program makeTable;
  60.  
  61. const tableLength=10;
  62. var paramNum,i:integer;
  63.                 x,pVal, oldpVal:extended;
  64.                 step:extended;
  65.                 
  66. procedure initialize;
  67. begin
  68.   paramNum:=1;
  69.   x:=pi;
  70.   step:=pi/10;
  71. end;
  72.  
  73.  
  74.  
  75. function myfunc (ex1: extended):extended;
  76. begin
  77.   myfunc:=callfunction('',ex1);
  78. end;
  79.  
  80. begin
  81.     input('tabulate which parameter?',paramNum,step,x);
  82.     pVal:=getFunctionParam('',paramNum);
  83.     oldpVal:=pVal;
  84.     for i:=1 to tableLength do
  85.         begin
  86.  
  87.  
  88.     setFunctionParam('',paramNum, pVal);
  89.              data[i,1]:=pVal;
  90.              data[i,2]:=myfunc(x);
  91.              pVal:=pVal+step;
  92.         end;
  93.      setFunctionParam('',paramNum, oldpVal);
  94. end;
  95.  
  96.  
  97.  
  98.  
  99.  
  100. function name;
  101. begin
  102.   y:= a[1]*sin(x) + a[2]*x;
  103. end;
  104.  
  105.  
  106. program name;
  107. const col1=1;
  108.       col2=2;
  109. var i:integer;
  110. begin
  111.  for i:=1 to nrRows do
  112.    if dataok(i,col1) then
  113.    begin
  114.      data[i,col2]:=sqr(data[i,col1]) +1;
  115.    end;
  116. end;
  117.  
  118. procedure myproc (i:integer; k: extended);
  119. begin
  120.   data[1,i]:=abs(k);
  121. end;
  122.  
  123.  
  124. function myfunc (ex1,ex2: extended): extended;
  125. begin
  126.   myfunc:=sin(ex1) + ex2;
  127. end;
  128.  
  129.  
  130. description 'text1', 'text2';
  131.  
  132.  
  133. parameters 3;
  134.  
  135.  
  136. defaults a[1]:=1.0, active, 'var1',0,inf;
  137.  
  138.  
  139. const c=2.99792458e8;
  140.       mu0=1.256637061435917295e-6;
  141.       eps0=8.854187817e-12;
  142.       G=6.67259e-11;
  143.       h=6.6260755e-34;
  144.       hbar=1.05457266e-34;
  145.       e=1.60217733e-19;
  146.       me=9.1093897e-31;
  147.       k=1.380658e-23;
  148.  
  149. var globalVar: extended;
  150.     myArray: array [1..3] of extended;
  151.  
  152.  
  153. repeat
  154.   statements;
  155.   x:=x+0.1;
  156. until x>limit;
  157.  
  158.  
  159. for i:=1 to nrRows do
  160. begin
  161.   statements;
  162. end;
  163.  
  164.  
  165. for i:=nrCols downto 1 do
  166. begin
  167.   statements;
  168. end;
  169.  
  170.  
  171. while i<j do
  172. begin
  173.   statements;
  174. end;
  175.  
  176.  
  177. if x>0 then
  178. begin
  179.   statements;
  180. end;
  181.  
  182.  
  183. if a[1]>0 then
  184. begin
  185.   statements;
  186. end
  187. else
  188. begin
  189.   statements;
  190. end;
  191.  
  192.  
  193. procedure initialize;
  194. begin
  195.   global:=0;
  196. end;
  197.  
  198.  
  199. function check;
  200. begin
  201.   check:=OK;
  202.   if (pNumber=1) and (a[1]<0) then
  203.     check:=BAD;
  204. end;
  205.  
  206.  
  207. procedure first;
  208. begin
  209.   global:=1*œÄ*a[1]^0.42;
  210. end;
  211.  
  212.  
  213. procedure derivatives;
  214. begin
  215.   dyda[1]:=0;
  216. end;
  217.  
  218.  
  219. procedure last;
  220. begin
  221.   beep;
  222. end;
  223.  
  224.  
  225.